package com.itheima.admin.mapper;


import com.itheima.admin.pojo.User;
import com.itheima.admin.vo.GrantRoleVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author WXL
 */
@Mapper
public interface UserMapper {

    @Select("select * from ss_user where user_id = #{id}")
    User selectById(String id);

    @Delete("delete from ss_user where user_id = #{id}")
    boolean delleteById(String id);

    @Insert("insert into ss_user values(#{userId},#{email},#{userName},#{station},#{password}" +
            ",#{state},#{managerId},#{gender},#{telephone},#{birthday}" +
            ",#{degree},#{salary},#{joinDate},#{orderNo},#{remark},#{deptId},#{deptName},#{createBy}" +
            ",#{createDept},#{createTime},#{updateBy},#{updateTime})")
    boolean addUser(User user);


    List<User> selectByPage(@Param("state") String status, @Param("username") String username);

    @Update("update ss_user set email=#{email},password=#{password},user_name=#{userName},dept_id=#{deptId},gender=#{gender}," +
            "state=#{state},birthday=#{birthday},join_date=#{joinDate},telephone=#{telephone} where user_id=#{userId}")
    boolean updateUser(User user);


    boolean grantRole(List<GrantRoleVo> list);
}
